<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="koction.model.rank.RankVO,java.util.List"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
    <% List<RankVO> list=(List<RankVO>)request.getAttribute("list");
    
    %>
  
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
       function drawChart() {
   		
  		var data = google.visualization.arrayToDataTable([
            
          ['검색어', '검색 횟수'],
       <%for(int i=0;i<list.size();i++) {%>
          ["<%=list.get(i).getKeyword()%>",<%=list.get(i).getCount() %>],
        <%}%> 
   
        ]);

        var options = {
          title: '검색어 통계입니다'
        };

        var chart = new google.visualization.PieChart(document.getElementById('piechart'));
        chart.draw(data, options);
      }
      
    </script>
관리자 검색어 통계입니다 
<hr>
<form name="ss">
 	 
<table border="1" cellpadding="5" id="rankTable" width="500">
	<thead bgcolor="yellow">
		<tr>
			<th>검색순위</th><th>검색어</th><th>검색어횟수</th>	
		</tr>
	</thead>
	<tbody>
		<c:forEach var="rvo" items="${requestScope.list}">
			<tr>
				<td>${rvo.ranking}</td><td>${rvo.keyword}</td><td>${rvo.count}</td>
				<input type="hidden" name="key" value="${rvo.keyword}">
				
			</tr>
			
		</c:forEach>
		
	</tbody>	
<div id="piechart" style="width: 500px; height: 500px;"></div>
</table>
</form>
